﻿namespace Security.Login
{
    using DevExpress.XtraEditors;
    using Extra.ERP;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class xfmIsAdmin : XtraForm
    {
        private SimpleButton btnClose;
        private SimpleButton btnStart;
        private IContainer components = null;
        public static bool isAdmin = false;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private TextEdit txtPassword;
        private TextEdit txtUserID;

        public xfmIsAdmin()
        {
            this.InitializeComponent();
            isAdmin = false;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            if (MyLogin.CheckAccount(this.txtUserID.Text, this.txtPassword.Text) == "OK")
            {
                XtraMessageBox.Show("T\x00e0i Khoản hoặc Mật Khẩu kh\x00f4ng đ\x00fang!\nVui l\x00f2ng kiểm tra lại.", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                isAdmin = true;
                base.Close();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xfmIsAdmin));
            this.txtUserID = new TextEdit();
            this.labelControl1 = new LabelControl();
            this.labelControl2 = new LabelControl();
            this.txtPassword = new TextEdit();
            this.btnClose = new SimpleButton();
            this.btnStart = new SimpleButton();
            this.txtUserID.Properties.BeginInit();
            this.txtPassword.Properties.BeginInit();
            base.SuspendLayout();
            this.txtUserID.Location = new Point(0x51, 12);
            this.txtUserID.Name = "txtUserID";
            this.txtUserID.Properties.Appearance.Font = new Font("Tahoma", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtUserID.Properties.Appearance.Options.UseFont = true;
            this.txtUserID.Size = new Size(0xb0, 0x16);
            this.txtUserID.TabIndex = 0;
            this.labelControl1.Location = new Point(12, 15);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(0x2f, 13);
            this.labelControl1.TabIndex = 1;
            this.labelControl1.Text = "T\x00e0i Khoản";
            this.labelControl2.Location = new Point(12, 0x2e);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(0x2d, 13);
            this.labelControl2.TabIndex = 3;
            this.labelControl2.Text = "Mật Khẩu";
            this.txtPassword.Location = new Point(0x51, 0x29);
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.Properties.Appearance.Font = new Font("Tahoma", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtPassword.Properties.Appearance.Options.UseFont = true;
            this.txtPassword.Size = new Size(0xb0, 0x16);
            this.txtPassword.TabIndex = 2;
            this.btnClose.Image = (Image) manager.GetObject("btnClose.Image");
            this.btnClose.Location = new Point(0xb6, 0x45);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new Size(0x4b, 0x1b);
            this.btnClose.TabIndex = 4;
            this.btnClose.Text = "Đ\x00f3ng";
            this.btnClose.Click += new EventHandler(this.btnClose_Click);
            this.btnStart.Image = (Image) manager.GetObject("btnStart.Image");
            this.btnStart.Location = new Point(0x65, 0x45);
            this.btnStart.Name = "btnStart";
            this.btnStart.Size = new Size(0x4b, 0x1b);
            this.btnStart.TabIndex = 5;
            this.btnStart.Text = "Thực Hiện";
            this.btnStart.Click += new EventHandler(this.btnStart_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x10d, 0x65);
            base.Controls.Add(this.btnStart);
            base.Controls.Add(this.btnClose);
            base.Controls.Add(this.labelControl2);
            base.Controls.Add(this.txtPassword);
            base.Controls.Add(this.labelControl1);
            base.Controls.Add(this.txtUserID);
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "xfmIsAdmin";
            base.ShowIcon = false;
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Đăng Nhập";
            base.TopMost = true;
            this.txtUserID.Properties.EndInit();
            this.txtPassword.Properties.EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

